@extends('backend/layouts/default')
@section('title')
Chỉnh sửa hợp âm
@stop
@section('content')
<h3>
    <span class="glyphicon glyphicon-user"></span> Chỉnh sửa hợp âm
</h3>
@if(Session::has('success'))
<h3>
    {{Session::get('success')}}
</h3>
@endif
<form class="form-horizontal" action="" method="post" role="form">
    <?= Form::token() ?>
    <input type="hidden" name="data[Lyric][id]" id="data[Lyric][id]" value="<?= $data['lyric']->id ?>"/>

    <div class="row">
        <div class="col-md-9">
            <div class="form-group <?= $errors->has('title') ? 'error' : '' ?>">
                <label class="control-label col-sm-4">Tiêu đề</label>

                <div class="col-sm-8">
                    <input type="text" name="data[Lyric][title]" id="data[Lyric][title]" class="form-control"
                           value="<?= $data['lyric']->title ?>"/>
                    <?= $errors->first('title', '<span class="help-inline">:message</span>') ?>
                </div>

            </div>

            <div class="form-group <?= $errors->has('embed') ? 'error' : '' ?>">
                <label class="control-label col-sm-4">Nhạc</label>

                <div class="col-sm-8">
                    <textarea name="data[Lyric][embed]" id="data[Lyric][embed]"
                              class="form-control"><?= $data['lyric']->embed ?>
                    </textarea>
                    <?= $errors->first('embed', '<span class="help-inline">:message</span>') ?>
                </div>

            </div>
            <div class="form-group <?= $errors->has('content') ? 'error' : '' ?>">
                <label class="control-label col-sm-4">Nội dung</label>

                <div class="col-sm-8">
                    <textarea name="data[Lyric][content]" id="data[Lyric][content]" class="form-control"
                              rows="25"><?= $data['lyric']->content ?>
                    </textarea>
                    <?= $errors->first('content', '<span class="help-inline">:message</span>') ?>
                </div>
            </div>
            <div class="form-group">
                <label class="control-label col-sm-4">
                    Tags
                </label>

                <div class="col-sm-8">
                    <input name="data[Tags]" id="data[Tags]" class="form-control"/>
                    @if(isset($data['tags']))
                    @foreach($data['tags'] as $tag)
                    <a href="javascript:void(0)" class="btn btn-danger btn-xs">{{$tag->title}}</a>&nbsp;
                    @endforeach
                    @endif
                </div>
            </div>
            <div class="form-group">
                <label class="control-label col-sm-4">Trạng thái</label>

                <div class="col-sm-8">
                    <?= Form::Select('data[Lyric][status]', Config::get('constants.TEXT_STATUS'), Input::old('data[Lyric][status]', $data['lyric']->status), array('class' => 'form-control')) ?>
                </div>
            </div>
        </div>
        <div class="col-md-3 colright">
            <div>
                <div class="panel panel-default">
                    <div class="panel-heading">Điệu</div>
                    <div class="panel-body" align="center">
                        <?= Form::Select('data[Lyric][tone_id]', $data['tones'], Input::old('data[Lyric][tone_id]', $data['lyric']->tone_id), array('class' => 'form-control')) ?>
                    </div>
                </div>
            </div>
            <div>
                <div class="panel-default panel">
                    <div class="panel-heading">Nhịp</div>
                    <div class="panel-body" align="center">
                        <input type="text" name="data[Lyric][rhythm]" value="<?= $data['lyric']->rhythm ?>"
                               class="form-control"/>
                    </div>
                </div>
            </div>
            <div>
                <div class="panel-default panel">
                    <div class="panel-heading">Chủ đề</div>
                    <div class="panel-body" align="center">
                        {{Form::select('data[Topics][]',$data['topics'],Input::old('$data[Topics][]',$data['topicables']),array('multiple'=>'multiple','class'=>'form-control','size'=>8))}}
                    </div>
                </div>
            </div>
            <div>
                <div class="panel panel-default">
                    <div class="panel-heading">
                        Ca sĩ
                    </div>
                    <div class="panel-body" align="center">
                        <input type="text" name="data[Singer][name]"  class="form-control"
                               id="autocomplete-singer" value="<?= (!is_null($data['singer'])) ? $data['singer']->name : ""; ?>"/>
                        <div id="selection"></div>
                        <input type="hidden" name="data[Singer][id]" id="singer-id" value="<?= (!is_null($data['singer'])) ? $data['singer']->id : ""; ?>"/>
                    </div>
                </div>
            </div>
            <div>
                <div class="panel panel-default">
                    <div class="panel-heading">
                        Nhạc sĩ
                    </div>
                    <div class="panel-body" align="center">
                        <input type="text" name="data[Musician][name]" class="form-control" id="autocomplete-musician" value="<?= (!is_null($data['musician'])) ? $data['musician']->name : ""; ?>"/>

                        <input type="hidden" name="data[Musician][id]" id="musician-id"
                               value="<?= (!is_null($data['musician'])) ? $data['musician']->id : ""; ?>"/>
                    </div>
                </div>
            </div>
            <div class="controls pull-right">
                <a class="btn btn-link" href="{{ route('lyrics') }}">Hủy</a>
                <button type="submit" class="btn btn-success btn-sm"><span
                        class="glyphicon glyphicon-floppy-disk"></span> Lưu lại
                </button>
            </div>
        </div>
    </div>
</form>
<link href="{{ asset('assets/commons/css/autocomplete.css')}}" rel="stylesheet"/>
<script type="text/javascript" src="{{ asset('assets/commons/js/jquery.mockjax.js')}}"></script>
<script type="text/javascript" src="{{ asset('assets/commons/js/jquery.autocomplete.js') }}"></script>
<script type="text/javascript" src="{{ asset('assets/commons/js/lyric.autocomplete.js') }}"></script>
@stop